#!/usr/bin/perl -w

use strict;

print "$0 1.pph.txt 1.pph_score.txt\n";





my %all2;
my @chr_pos2;

open(FIL2, $ARGV[1]);
while (<FIL2>) {
	chomp;
	@chr_pos2 = split /\t/; # 默认以空白符分割
	$all2{$chr_pos2[0]}  = $_;
}
close(FIL2);

# foreach my $key (keys %all2) {
	# print "$all2{$key}\n";
# }

open(FIL1, $ARGV[0]);
open(FIL3, ">1.pph_score2.txt");
while (<FIL1>) {
	chomp;
	my @chr_pos1 = split /\t/;
	# print "@chr_pos1\n";
	if (exists $all2{$chr_pos1[0]}) {
		# print "$all2{$chr_pos1[0]}\n";
		print FIL3 "$all2{$chr_pos1[0]}\n";
		delete $all2{$chr_pos1[0]};
	}else {
		print FIL3 "$chr_pos1[0]\t";
		foreach (1..$#chr_pos2-1) {
			print FIL3 "\t";
		}
		print FIL3 "\n";
	}
	
}

close(FIL1);
close(FIL3);

	

